class ScorePanel {
    score = 0
    level = 1
    scoreElement: HTMLElement
    levelElement: HTMLElement

    maxLevel: number
    upScore: number

    constructor(upScore: number = 10, maxLevel:number = 10) {
        this.scoreElement = document.getElementById('score')!
        this.levelElement = document.getElementById('level')!
        this.maxLevel = maxLevel
        this.upScore = upScore
    }

    addScore() {
        this.scoreElement.innerHTML = ++this.score + ''
        if(this.score % this.upScore === 0) {
            this.upLevel()
        }
    }

    upLevel() {
        if(this.level < this.maxLevel) {
            this.levelElement.innerHTML = ++this.level + ''
        }
    }
}

export default ScorePanel